
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
@Project ：图灵学习 
@File    ：10.集合内置方法.py
@IDE     ：PyCharm 
@Author  ：ChenLiGao
@Date    ：2024-09-27 09:31
'''


int_set = {1, 2, 3}

int_set.add(4)

print(int_set)

""" claer"""

int_set.clear()
print(int_set)


str_set = {'a', 'b', 'c'}
str_set_2 = str_set.copy()
print(id(str_set), id(str_set_2))
str_set.add("d")

print(str_set, str_set_2)

str_set = {'a', 'b', 'c'}
str_set_3 = str_set
print(id(str_set), id(str_set_3))
str_set.add("d")
print(str_set, str_set_3)

""" 随机弹出元素"""
int_set = {'1', '2', "cd","3434","3"}
data = int_set.pop()
print(data)
print(int_set)

int_set.remove("1")
print(int_set)